package com.sigmazero13.gameutils;

import java.util.List;

import android.os.Bundle;

import com.sigmazero13.gameutils.RenameDialog.OnRenameListener;

public class PlayerList extends RenamableInfoList {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	@Override
	protected String getDialogTitle() {
		return getString(R.string.rename_dialog_title_player);
	}

	@Override
	protected OnRenameListener getDialogRenameListener() {
		return new OnRenameListener() {
			@Override
			public void onRename(String origName, String newName) {
				((BoardGameUtilsApp)PlayerList.this.getApplication()).getDbHelper().renamePlayer(origName, newName);
				updateList();
			}
		};
	}

	@Override
	protected List<String> getList() {
		return ((BoardGameUtilsApp)PlayerList.this.getApplication()).getDbHelper().getPlayerNames();
	}
}
